import com.sun.deploy.panel.ITreeNode;

public class Activity {
    private State state;
     int PrizeCount;

   private NoRaffleState noRaffleState = new NoRaffleState(50*1000,this);
   private CanRaffleState canRaffleState = new CanRaffleState(this);
   private DispenseState dispenseState =new DispenseState(this);



    public Activity(int prizeCount) {
        this.state = noRaffleState;
       this.PrizeCount = prizeCount;
    }

    public void debuctMoney(){
        if (PrizeCount==0){
            System.out.println("奖品已发送完毕,抽奖活动结束");
            System.exit(0);
        }
        state.deductMoney();
    }

    public void raffle(){
        if(state.raffle()){
            state.dispensePrize();
        }
    }

    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    public int getPrizeCount() {
        int Count = PrizeCount;
        PrizeCount--;
        return Count;
    }

    public void setPrizeCount(int prizeCount) {
        PrizeCount = prizeCount;
    }

    public NoRaffleState getNoRaffleState() {
        return noRaffleState;
    }

    public void setNoRaffleState(NoRaffleState noRaffleState) {
        this.noRaffleState = noRaffleState;
    }

    public CanRaffleState getCanRaffleState() {
        return canRaffleState;
    }

    public void setCanRaffleState(CanRaffleState canRaffleState) {
        this.canRaffleState = canRaffleState;
    }

    public DispenseState getDispenseState() {
        return dispenseState;
    }

    public void setDispenseState(DispenseState dispenseState) {
        this.dispenseState = dispenseState;
    }
}
